import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'


const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView,
    redirect:'/indexs',
    children:[
      {path: '/indexs', component: () => import('../views/home/indexs.vue')},
      {path: '/relogin', component: () => import('../views/login/ReLoginView.vue')},
      {path: '/recommended', component: () => import('../views/home/Recommended.vue')},
      {path: '/exp', component: () => import('../views/home/Exp.vue')},
      {path: '/culture', component: () => import('../views/home/Culture.vue')},
      {path: '/oneProduct', component: () => import('../views/product/oneProduct.vue')},
      {path: '/user', component: () => import('../views/user/index.vue'),
        redirect:'/user/zhanghao',
      children:[
        {path: 'zhanghao', component: () => import('../views/user/Zhanghao.vue')},
        {path: 'dingdan', component: () => import('../views/user/Dingdan.vue')},
        {path: 'dingdan2', component: () => import('../views/user/Dingdan2.vue')},
        {path: 'shouhuo', component: () => import('../views/user/Shouhuo.vue')},
        {path: 'shangpin', component: () => import('../views/user/Shangpin.vue')},
        {path: 'kefu', component: () => import('../views/user/Kefu.vue')},
        {path: 'dianpu', component: () => import('../views/user/Dianpu.vue')},
      ]}
    ]
  },
  {
    path: '/login', component: () => import('../views/LoginView.vue')
  },
  {
    path: '/admin',
    component: () => import('../views/admin/AdminHomeView.vue'),
    redirect:'/admin/Alluser',
    children:[
      {path: 'Alluser', component: () => import('../views/admin/Alluser.vue')},
      {path: 'Allseller', component: () => import('../views/admin/Allseller.vue')},
      {path: 'Allproduct', component: () => import('../views/admin/Allproduct.vue')},
      {path: 'Allreview', component: () => import('../views/admin/Allreview.vue')},
    ]
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
